package at.fhooe.mc.master.clc.server.domain.jpa;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.datanucleus.api.jpa.annotations.Extension;

import at.fhooe.mc.master.clc.server.domain.AbstractTestable;
import at.fhooe.mc.master.clc.server.domain.ISmallEntity;

@Entity
public class SmallEntityJpa extends AbstractTestable implements ISmallEntity
{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id; // automatically populated by JPA
	
	private String stringField;
	@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")
	private int intField;
	@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")
	private double doubleField;
	@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")
	private Date dateField;
	
	public SmallEntityJpa() {}
	
	public SmallEntityJpa(boolean generate)
	{
		if (generate)
		{
			this.stringField = "String Test Field";
			this.intField = 42;
			this.doubleField = 42.42;
			this.dateField = new Date();
		}
	}
	
	@Override
	public Long getId()
	{
		return this.id;
	}
	
	@Override
	public String getStringField()
	{
		return this.stringField;
	}

	@Override
	public int getIntField()
	{
		return this.intField;
	}

	@Override
	public double getDoubleField()
	{
		return this.doubleField;
	}

	@Override
	public Date getDateField()
	{
		return this.dateField;
	}
	
	@Override
	public String getDistinguishable()
	{
		return this.stringField;
	}
	
	@Override
	public void setDistinguishable(String uuid)
	{
		this.stringField = uuid;;
	}

}
